//
//  e7filemanager.mm
//  E7_ENGINE
//
//  Created by cc on 12-4-21.
//  Copyright (c) 2012年 cc. All rights reserved.
//

namespace e7engine {

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#import "E7FileManager.h"

/*
 BOOL bisDevOn=NO;
 NSString *cyd=@"/Applications/Cydia.app";
 NSString *apt=@"/private/var/lib/apt/";
 if ([[NSFileManager defaultManager] fileExistsAtPath:cyd]) {
 bisDevOn=YES;
 }
 if ([[NSFileManager defaultManager] fileExistsAtPath:apt]) {
 bisDevOn=YES;
 }
 */

@interface NS_FileManager : NSObject <UIAlertViewDelegate>

+(bool) CheckFakerDev ;

- (void)alertView : (UIAlertView *)alertView clickedButtonAtIndex : (NSInteger)buttonIndex ;

@end

@implementation NS_FileManager

+(bool) CheckFakerDev
{
    bool res ;

    NSString* cyd = @"/Applications/Cydia.app" ;
    NSString* apt = @"/private/var/lib/apt/" ;
    if ([[NSFileManager defaultManager] fileExistsAtPath:cyd])
    {
        res = true ;
    }
    else if ([[NSFileManager defaultManager] fileExistsAtPath:apt])
    {
        res = true ;
    }
    else
    {
        res = false ;
    }

    if (res)
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"ERROR"
                                                        message:@"Faker Device ID!!"
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil] ;
        [alert show];
        [alert release];
    }

    return res ;
}

- (void)alertView : (UIAlertView *)alertView clickedButtonAtIndex : (NSInteger)buttonIndex
{
    NSLog(@"enter alertview") ;
    exit(EXIT_FAILURE) ;
//    if(alertView == alertWithOkButton)
//    {
//        NSLog(@"The ok button in the first allert was pressed\n");
//    }
//    
//    if(alertView == alertWithYesNoButtons)
//    {
//        if(buttonIndex == 0)
//        {
//            NSLog(@"no button was pressed\n");
//        }
//        else
//        {
//            NSLog(@"yes button was pressed\n");
//        }
//    }
}

@end


CE7FileManager::CE7FileManager()
{
}

CE7FileManager::~CE7FileManager()
{
}

bool CE7FileManager::IsFakerDevID()
{
    bool res = [NS_FileManager CheckFakerDev] ;
    return res ;
}


}






















